<% total_geral = 0 %>
<% @depositos.each do |d| %>
<% rowspan = true %>
    <% pares_por_deposito = 0 %>
    <table class="sortida <%= d.cor.downcase_br %>">
        <!-- <caption><%= h d.nome.upcase_br %></caption> -->
        <thead>
        <tr>
            <!--<th style="width:8%;">Deposito</th>-->
			<th style="width:1%;">X</th>
            <th style="width:5%;">BOX</th>
            <th style="width:7%;">Nº TD</th>
            <!--<th style="width:10%;">Hora</th>-->
            <th style="width:8%;">TRANSP.</th>
            <th style="width:6%;">ITINERÁRIO</th>
            <th style="width:7%;">PRS</th>
            <th style="width:7%;">CXS</th>
            <th style="width:6%;">TIPO</th>
            <th style="width:6%;">VOL</th>
            <th style="width:6%;">PESO</th>
            <th style="width:7%;">STATUS</th>
            <!--<th style="width:5%;">Etq</th>-->
            <th style="width:5%;">CAR</th>
            <th style="width:5%;">DESTINO</th>
            <!--<th style="width:4%;">ETQ</th>-->
            <th style="width:20%;">OBS</th>
        </tr>
        </thead>
        <tbody>
		<% rowspan = true %>
        <% d.transportes.each do |wm| %>			
            <tr class="<%= cycle("even", "odd") %>">
                <% armazenamento = Armazenamento.deposito_transporte(d.id, wm.id)[0] %>
				<% if rowspan %>
				<% title = ""
				   d.nome.upcase_br.each_char {|c| title << "#{c} " } %>
				<td rowspan='<%= d.transportes.size.to_s %>' class='title_vertical <%= d.cor.downcase_br %>'><%= title %></td>				
				<%end%>			
                <!--<td><%= armazenamento.deposito.nome %></td>-->
                <td><%= armazenamento.box %></td>
                <td><%= wm.ndt %></td>
                <!--<td><%= wm.created_at.to_s[11..15] %></td>-->
                <td><%= wm.transportadora.nome.upcase %></td>
                <td><%= wm.destino.sigla.upcase %></td>
                <td><%= armazenamento.pares.para_dinheiro.to_s_m %></td>
                <td><%= armazenamento.cxs.para_dinheiro.to_s_m %></td>
                <td><%= wm.tipo.sigla.upcase %></td>
                <td><%= wm.m.para_dinheiro.to_s_m %></td>
                <td><%= wm.peso.para_dinheiro.to_s_m %></td>                
                <td><%= wm.status.sigla.upcase %></td>
                <!--<td>-->
                    <!--<%= wm.etiqueta == false ? image_tag('../../images/cross.png') : image_tag('../../images/tick.png')%>-->
                <!--</td>-->
                <td>
                    <%= wm.carro == false ? image_tag('../../images/cross.png') : image_tag('../../images/tick.png')%>
                </td>
                <td><%= wm.itinerario %></td>
                <% pares_por_deposito += armazenamento.pares %>
                <!--<td><%= armazenamento.cxs.para_dinheiro.to_s_m %></td>-->
                <!-- <td><%= wm.created_at.to_s[11..15] %></td> -->

                <td><%= wm.obs_trans %></td>
            </tr>
			<% rowspan = false %>
        <% end %>
        </tbody>
        <tfoot>
        <tr>
			<td></td>
            <td>TOTAIS:</td>
            <!--<td></td>-->
            <td></td>
            <td></td>
            <td></td>
            <td><%= pares_por_deposito.para_dinheiro.to_s_m %></td>
            <% total_geral += pares_por_deposito %>
            <td></td>
            <td></td>
            <td></td>
            <td></td>
            <td></td>
            <!--<td></td>-->
            <!--<td></td>-->
            <!--<td></td>-->
            <td></td>
        </tr>
        </tfoot>
    </table>
<% end %>
<div class="total">
    <strong>TOTAL:</strong> <%= total_geral.to_i.para_dinheiro.to_s_m %>
</div>